Package edu.claflin.finder.algo
Class ArgumentsBundle
java.lang.Object
edu.claflin.finder.algo.ArgumentsBundle
Used to supply arguments to Algorithms in a generalized manner. The caller is
required to put arguments on the bundle prior to passing it to the
Algorithm's constructor. The algorithm, then, can interpret the arguments it
wants to and ignore others. This generalizes the constructor of the abstract
Algorithm object so that algorithms that take different arguments may be
created without complicating the constructors of others.
Specifically, the bundle supports the following kinds of arguments: - Enums -
Integers - Floats - Objects - a special Condition object list
- Version:
- 3.0 February 2, 2016
- Author:
- Charles Allen Schultz II
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration containing common arguments used by the program. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe Mapping of String keywords to Notable Boolean values.The List of conditions to apply to the Algorithm.The Mapping of String keywords to Notable Double values.The Mapping of String keywords to Notable Enum values.The Mapping of String keywords to Notable Integer values.The Mapping of String keywords to Notable objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCondition(Condition condition) Adds a Condition to the conditionsList.getBoolean(String key) Gets a boolean from the booleanList.Gets a copy of the conditionsList that will not structurally modify the one owned by the bundle.Gets a double from the doubleList.Enum<?>Gets an enum from the enumList.getInteger(String key) Gets an integer from the integerList.Gets an object from the enumList.voidputBoolean(String key, Boolean val) Puts a boolean in the booleanList.voidPuts a double in the doubleList.voidPuts an enum in the enumList.voidputInteger(String key, Integer val) Puts an integer in the integerList.voidPuts an object in the enumList.voidremoveBoolean(String key) Removes a boolean from the booleanList.voidremoveCondition(Condition condition) Removes a Condition from the conditionsList.voidremoveDouble(String key) Removes a double from the doubleList.voidremoveEnum(String key) Removes an enum from the enumList.voidremoveInteger(String key) Removes an integer from the integerList.voidremoveObject(String key) Removes an object from the enumList.toString()
-
Field Details
-
conditionsList
The List of conditions to apply to the Algorithm. -
integerList
The Mapping of String keywords to Notable Integer values. -
doubleList
The Mapping of String keywords to Notable Double values. -
booleanList
The Mapping of String keywords to Notable Boolean values. -
enumList
The Mapping of String keywords to Notable Enum values. -
objectsList
The Mapping of String keywords to Notable objects.
-
-
Constructor Details
-
ArgumentsBundle
public ArgumentsBundle()Constructs the ArgumentsBundle.
-
-
Method Details
-
addCondition
Adds a Condition to the conditionsList.- Parameters:
condition- the Condition object to add.
-
removeCondition
Removes a Condition from the conditionsList.- Parameters:
condition- the Condition object to remove.
-
getConditionsList
Gets a copy of the conditionsList that will not structurally modify the one owned by the bundle.- Returns:
- a List of Conditions held in this ArgumentsBundle.
-
putInteger
Puts an integer in the integerList.- Parameters:
key- the String keyword which maps to the integer.val- the Integer to put.
-
removeInteger
Removes an integer from the integerList.- Parameters:
key- the String keyword which maps to the integer.
-
getInteger
Gets an integer from the integerList.- Parameters:
key- the String keyword which maps to the integer.- Returns:
- the Integer in the list or null if not present.
-
putDouble
Puts a double in the doubleList.- Parameters:
key- the String keyword which maps to the double.val- the Double to put.
-
removeDouble
Removes a double from the doubleList.- Parameters:
key- the String keyword which maps to the double.
-
getDouble
Gets a double from the doubleList.- Parameters:
key- the String keyword which maps to the double.- Returns:
- the Double in the list or null if not present.
-
putBoolean
Puts a boolean in the booleanList.- Parameters:
key- the String keyword which maps to the boolean.val- the Boolean to put.
-
removeBoolean
Removes a boolean from the booleanList.- Parameters:
key- the String keyword which maps to the boolean.
-
getBoolean
Gets a boolean from the booleanList.- Parameters:
key- the String keyword which maps to the boolean.- Returns:
- the Boolean in the list or null if not present.
-
putEnum
Puts an enum in the enumList.- Parameters:
key- the String keyword which maps to the enum.val- the Enum to put.
-
removeEnum
Removes an enum from the enumList.- Parameters:
key- the String keyword which maps to the enum.
-
getEnum
Gets an enum from the enumList.- Parameters:
key- the String keyword which maps to the enum.- Returns:
- the Enum in the list or null if not present.
-
putObject
Puts an object in the enumList.- Parameters:
key- the String keyword which maps to the object.val- the Object to put.
-
removeObject
Removes an object from the enumList.- Parameters:
key- the String keyword which maps to the object.
-
getObject
Gets an object from the enumList.- Parameters:
key- the String keyword which maps to the object.- Returns:
- the Object in the list or null if not present.
-
toString
-